package com.bird.设计模式.结构型.组合模式;

/**
 * @data 2022/3/15 17:31
 * @author: bird
 * @description: 课程类
 */
public class Course extends CatalogComponent {

    private String name;  //课程的名称
    private Double price; //课程的价格

    public Course(String name, Double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName(CatalogComponent catalogComponent) {
        return this.name;
    }

    @Override
    public Double getPrice(CatalogComponent catalogComponent) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println("Course Name: " + name + "Price" + price);
    }
}
